{extend name="default/template/base_index"/}
{block name="area_header"}

{/block}
{block name="area_body"}

    {include file="default/Widget/topbar" /}
    <div class="admin-main container-fluid">
        {include file="default/Widget/left" /}
        <div class="admin-main-content">
            {include file="default/Widget/breadcrumb" /}

            <h2>插件列表</h2>

            <div class="filter-controls">
                <a href="{:url('Addons/create')}" class="btn btn-sm btn-primary">快速创建</a>
            </div>

            <!-- 数据列表 -->
            <div class="table-responsive">
                <table class="table table-striped table-hover table-condensed">
                    <thead>
                    <tr>
                        <th>名称</th>
                        <th>标识</th>
                        <th>描述</th>
                        <th width="43px">状态</th>
                        <th width="43px">版本</th>
                        <th width="94px">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {notempty name="_list"}
                        {volist name="_list" id="vo"}
                            <tr>
                                <td>{$vo.title}</td>
                                <td>
                                    <eq name="vo['has_adminlist']" value="1">
                                        <a href="{:url('Addons/adminlist',array('name'=>$vo['name']))}">{$vo.name}</a>
                                    {else/}{$vo.name}
                                    {/eq}
                                </td>
                                <td>{$vo.description}</td>
                                <td>{$vo._status_text|default="未安装"}</td>
                                <td>{$vo.version}</td>
                                <td>
                                    <empty name="vo.uninstall">
                                        <?php
								$class	= get_addon_class($vo['name']);
								if(!class_exists($class)){
									$has_config = 0;
								}else{
									$addon = new $class();
									$has_config = count($addon->getConfig());
                                        }
                                        ?>
                                        <?php if ($has_config): ?>
                                        <a href="{:url('config',array('id'=>$vo['id']))}">设置</a>
                                        <?php endif ?>
                                        <?php if ($vo['status'] >=0): ?>
                                        <eq name="vo.status" value="0">
                                            <a class="ajax-get" href="{:url('enable',array('id'=>$vo['id']))}">启用</a>
                                            {else/}
                                            <a class="ajax-get" href="{:url('disable',array('id'=>$vo['id']))}">禁用</a>
                                        {/eq}
                                        <?php endif ?>
                                        {//
                                        <eq name="vo.author" value="thinkphp">}
                                            <a class="ajax-get" href="{:url('uninstall?id='.$vo['id'])}">卸载</a>
                                            {//
                                        {/eq}
                                        }
                                        {else/}
                                        <a class="ajax-get" href="{:url('install?addon_name='.$vo['name'])}">安装</a>
                                    {/empty}
                                </td>
                            </tr>
                        {/volist}
                        {else/}
                        <td colspan="6" class="text-center"> aOh! 暂时还没有内容!</td>
                    {/notempty}
                    </tbody>
                </table>
            </div>
            <!-- 分页 -->
            <div class="page">
                {$_page}
            </div>


        </div>
        <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
{/block}
